﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BrnMall.Manager.Domain.WeApp;

namespace BrnMall.Manager.Manager.WeApp
{
    public static class StoreAppPageManager
    {
        public static void AddPageSetting(StoreAppPageSetting setting)
        {
            using (var db = new QDMallDatabase())
            {
                db.Insert(setting);
            }
        }
        public static void UpdatePageSetting(StoreAppPageSetting setting)
        {
            using (var db = new QDMallDatabase())
            {
                db.Update(setting);
            }
        }
        public static void DelPageSetting(int id)
        {
            using (var db = new QDMallDatabase())
            {
                db.Delete<StoreAppPageSetting>(id);
            }
        }

        public static StoreAppPageSetting GetAppPageSetting(int storeAppId, string path)
        {
            using (var db = new QDMallDatabase())
            {
                return db.SingleOrDefault<StoreAppPageSetting>(
                    "select * from weapp_StoreAppPageSetting where storeappid=@0 and path=@1", storeAppId, path);
            }
        }
        public static StoreAppPageSetting GetAppPageSetting(int id)
        {
            using (var db = new QDMallDatabase())
            {
                return db.SingleOrDefault<StoreAppPageSetting>(id);
            }
        }
    }
}
